/***************************************************************
Made by: Cultured::Labs

Copyright (c) 2011 Cultured::Labs
****************************************************************/
#include <iostream>
#include "spaceship.h"
#include "nextEnemy.h"
#include "printStats.h"
using namespace std;


int main() {
  //player score
  unsigned int lives = 3;
  unsigned int victories = 0;
  unsigned int defeats = 0;
  int enemy_flag = 0;
  bool battle_winner = false; //TRUE==Player, FALSE==PC
  int menu_tag;

  //creates player's spaceship
  string input = "Sponge";
  //cin >> input;
  Spaceship player_spaceship(input, 15, 1, 2);

  //game loop
  do {
    menu_tag = -1;
    cout << endl;
    cout << "[1] Fight!" << endl;
    cout << "[2] Show stats" << endl;
    cin >> menu_tag;

    //fight
    if (menu_tag == 1) {
      battle_winner = nextEnemy(player_spaceship, enemy_flag);
      if (battle_winner == true) {
        cout << "You win" << endl;
        victories++;
      } else {
        cout << "You lose!" << endl;
        lives--;
        defeats--;
      }
    }

    //stats
    else if (menu_tag == 2) {
      printStats(player_spaceship, lives, victories, defeats);
    }

    //error
    else {
      cout << "Wrong input! Please choose a available option." << endl;
    }
  } while (lives != 0 && enemy_flag != 2);


  cout << endl << endl << "end of game!" << endl;
  cin.get();
  cin.get();
}
